package com.xujl.mvcbind.ui.element;

import android.view.ViewStub;

import com.xujl.elementlib.main.BaseElement;
import com.xujl.fastlib.utils.ImgHelper;
import com.xujl.mvcbind.R;
import com.xujl.mvcbind.bean.DetailEntity;
import com.xujl.mvcbind.databinding.ElementDetailBinding;

import androidx.databinding.ObservableField;

/**
 * @author x
 * @Description
 */
public class DetailElement extends BaseElement<ElementDetailBinding> {
    public ObservableField<String> title = new ObservableField<>();
    public ObservableField<String> info = new ObservableField<>();
    public ObservableField<String> price = new ObservableField<>();

    public DetailElement (ViewStub viewStub) {
        super(viewStub);
    }

    @Override
    protected int getLayoutId () {
        return R.layout.element_detail;
    }

    @Override
    public void initView () {
        super.initView();

    }

    public void setData (DetailEntity entity) {
        title.set(entity.getTitle());
        info.set(entity.getInfo());
        price.set(entity.getPrice());
        ImgHelper.loadImgNormal(mBind.getRoot().getContext(), mBind.iv, entity.getImg());
    }
}
